<?php 
namespace CLUB\Controller;
use Think\Controller;
/**
* 培训业务逻辑
*/
class TrainingController extends PubController
{
	public function tralist(){
	   $t = M('Clubclass');
	   $count = $t -> count();
	   $pagesize = 15;
	   $Page = new \Think\Page($count,$pagesize);// 实例化分页类 传入总记录数和每页显示的记录数
	   $list = $t->limit($Page->firstRow.','.$Page->listRows)->select();
	   $Page->setConfig('prev', '上一页');
       $Page->setConfig('next', '下一页');
	   $show = $Page -> show();
	   $this -> assign('tralist',$list);
	   $this -> assign("page",$show);
	   $this -> display();
	}

	public function addtraining(){
	  $this -> display();
	}
	public function newtraining(){
		$t = M('Clubclass');
		$t->ccname = $_POST['ccname'];
		$t->ccintro = $_POST['ccintro'];
		$t->cnots = $_POST['cnots'];
		$t->cctime = $_POST['cctime'];
		$t->ccaddress = $_POST['ccaddress'];
		$t->ccprice = $_POST['ccprice'];
		$t->clubid = $_SESSION['clubid'];
		$t->ccpic = $this ->uploadfile($_FILES['ccpic'],'./Public/upload/');
		if (false!=$t ->add()) {
			$this -> redirect("Training/tralist",'',2,'添加成功，页面跳转中...');
		}else{
			$this -> error('哎呀！出错了...');
		}

	}
	
}